
	** Clean Wave 2
	
		** Household info
			
			* can't seem to find a variable with urban status?		
		
		** Roster
		
			use "$dir/rawdata/GSPS Ghana/Wave 2/01b2_roster.dta", clear
			
			gen w2_female=gender==5 if !missing(gender)
			gen w2_inhh=stillmember==1 if !missing(stillmember)
			gen w2_married=maritalstatus==1 if !missing(maritalstatus)
			gen w2_age=ageyears if !missing(ageyears)
			
			bys FPrimary: gen w2_hh_size=_N
			
			keep FPrimary hhmid w2_*
			
			tempfile roster
			save `roster', replace
			
		** Depression
			
			use "$dir/rawdata/GSPS Ghana/Wave 2/10ai_depression.dta", clear
		
			replace sonervous=1 if nervous==1
			replace sorestless=1 if restless==1
			
			egen w2_depression_score=rowtotal(tired nervous sonervous hopeless restless sorestless depressed everythingeffort nothingcheerup worthless), mi
			egen w2_depression_nonmiss=rownonmiss(tired nervous sonervous hopeless restless sorestless depressed everythingeffort nothingcheerup worthless)
			replace w2_depression_score=. if w2_depression_nonmiss<10 // FIXME: Check if this is the right way
			
			gen w2_depressed=w2_depression_score>=25 if !missing(w2_depression_score) // moderate or severe
			*gen w2_depressed=w2_depression_score>=30 if !missing(w2_depression_score) // severe
						
			tostring FPrimary, replace
			
			keep FPrimary hhmid w2_*
			
			tempfile depression
			save `depression', replace
				
		** Ever covered by health insurance
		
			use "$dir/rawdata/GSPS Ghana/Wave 2/06a_insurance.dta", clear
			
			gen w2_healthinsurance_ever=everinsured==1 if !missing(everinsured)
			keep FPrimary hhmid w2_healthinsurance_ever
			tostring FPrimary, replace
			
			tempfile healthinsurance
			save `healthinsurance', replace
		
		** Illness or injury over the past 2 weeks
		
			use "$dir/rawdata/GSPS Ghana/Wave 2/06f_past2weeks.dta", clear
			
			gen w2_ill_inj=(anyillness==1 | anyillness==2 | anyillness==3) if !missing(anyillness)
			gen w2_ill_inj_stopactivity=stopactivities==1 if !missing(stopactivities) 
			replace w2_ill_inj_stopactivity=0 if w2_ill_inj==0
				
			keep FPrimary hhmid w2_*
			tostring FPrimary, replace
			tempfile illnessinjury
			save `illnessinjury', replace
									
		** Merge and save
			use `roster', clear
			*merge 1:1 FPrimary hhmid using `employment1', gen(merge_employment1)
			*merge 1:1 FPrimary hhmid using `employment2', gen(merge_employment2)
			*merge 1:1 FPrimary hhmid using `enterprise', gen(merge_enterprise)
			merge 1:1 FPrimary hhmid using `depression', gen(merge_depression)
			merge 1:1 FPrimary hhmid using `healthinsurance', gen(merge_healthinsurance)
			merge 1:1 FPrimary hhmid using `illnessinjury', gen(merge_illinj)
			*merge m:1 FPrimary using `urban', gen(merge_urban)
			
			ren FPrimary hhid
			ren hhmid indiv
			
			order hhid indiv w2_*
			keep hhid indiv w2_*
			
			destring hhid, replace
			
			save "$dir/data/gha_w2_individual.dta", replace
			
				
		** Source for Kessler depression stuff

			* https://www.worksafe.qld.gov.au/__data/assets/pdf_file/0010/22240/kessler-psychological-distress-scale-k101.pdf
					